<template>
  <div>
    <div>动态路由</div>
    <div>
      <a-button type="primary" @click="addRouter">添加路由</a-button>
    </div>
    <div>
      <a-button type="primary" @click="jump">跳转测试</a-button>
    </div>

    <RouterView></RouterView>
  </div>
</template>

<script>
export default {
  methods: {
    addRouter() {
      this.$router.addRoute("home", {
        //   this.$router.addRoute("DynamicRouting", {
        path: "/NewPage",
        component: () => import("./NewPage.vue"),
      });
    },
    jump() {
      this.$router.push({ path: "/NewPage" });
    },
  },
};
</script>

<style lang="scss" scoped></style>
